#ifndef _SCUDB_OPLOG_H_
#define _SCUDB_OPLOG_H_

#include "sd_global.h"
#include "sd_blist.h"


struct sd_TTree;
/* Definition of Undo log for rollback of the transaction */
typedef enum 
{
	SD_OP_INSERT = 0,
	SD_OP_DELETE = 1,
}sd_OpType;

typedef struct sd_OpLogItem
{
	sd_OpType type;
	sd_Record record;
	struct sd_TTree* index;
}sd_OpLogItem;

typedef sd_Blist sd_OpLog;
typedef sd_BlistIterator sd_OpLogIterator;

#define sd_OpLogCreate(log,listNodeSize) sd_BlistCreate(log, sizeof(sd_OpLogItem), listNodeSize, NULL)
#define sd_OpLogFree(log) sd_BlistFree(log)
#define sd_OpLogPushback(log, item) sd_BlistPushback(log, item)
#define sd_OpLogBegin(log, iter) sd_BlistBegin(log, (sd_BlistIterator*)(iter))
#define sd_OpLogNext(iter) sd_BlistNext((sd_BlistIterator*)iter)
#define sd_OpLogGet(iter,item) sd_BlistGet((sd_BlistIterator*)iter, item)
#define sd_OpLogClear(log) sd_BlistClear(log)


#define sd_OpLogUndoType(type) (type==SD_OP_INSERT?SD_OP_DELETE:SD_OP_INSERT)












#endif
